package com.junzhiit.nengji.model.enums;

import com.bainaeco.framework.exception.InvalidArgumentException;

public enum MemberCardUseType {
	FREE_SHIPPING(0,"包邮"),
	DISCOUNT(1,"折扣");
	
	private Integer value;
	private String text;

	private MemberCardUseType(Integer value,String text) {
		this.value = value;
		this.text = text;
	}

	public Integer toIntValue() {
		return this.value;
	}
	
	public String toStringText() {
		return this.text;
	}

	public static MemberCardUseType toStatus(Integer value) {
		if (FREE_SHIPPING.value == value) {
			return FREE_SHIPPING;
		} else if (DISCOUNT.value == value) {
			return DISCOUNT;
		}else {
			throw new InvalidArgumentException("Unknown OrderStatus[" + value + "].");
		}
	}
}
